package top.v5it.japi.ddd.core.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 清理资源
 *
 * @author zhanpu
 * @date 2023/4/25
 */
@Component
@Slf4j
public class CleanInterceptor implements HandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        // 清理请求头信息
        HttpHeadFactory.INSTANCE.remove();
    }
}
